Remote Control
Design The remote control is used to control the machine. No controls exist on the actual machine so everything is done using the remote. This was done to reduce the cost and not duplicate controls. The remote control had to be small and light, and ideally, smaller than a phone. At first, I considered writting an app on my phone and communicating via Bluetooth but Bluetooth components were very expensive so I opted to build a remote control using AM RF 433MHz. Given the distance, IR was not appropriate. Initial design involved using led indicators, radial potentiometers as dials and pushbuttons but this was surprisingly expensive because of all the support circuitry required. Using a LCD and touch screen was by far the cheapest options however a lot more programming was required. The remote control is 15mm thick (LCD 3mm, Touchscreen 2mm, Battery 10mm). I may in future switch to a LiPo battery which would allow me to bring the thickness down to 8-10mm and reduce the weight as the battery is heaviest component. In the end, the LCD Touchscreen remote control used the following components: *Displaytech (64128M-COG-FA-BC) 128x64 pixel graphics LCD. (RS Components, £11). 75mm x 50mm x 3mm. I needed a thin LCD unit using a serial interface and this was the best out of a bad lot. I would have preferred to use a unit with no additional hardware required. This LCD required 7 capacitors connected between pins that are 0.05" apart which was a real pain. *Sparkfun DS resistive touchscreen (Technobots £8) *Sparkfun DS touchscreen connector (£3). Make sure you get this because the connectors on the touchscreen are microscopic. This will give you the 4 connections at a more normal 0.1" spacing. I soldered pull-down resistors on two of the pins. *Arduino Pro Mini 3.3v 328p microprocessor (£15) *AM RF 433MHz transmitter (£3). The power pin on this was connected to a digital pin on the Arduino so that I could switch the power on and off. I did this because the quiescent current was too high. *1/3AAA x 3 rechargeable 210mAH NiMH battery pack 3.6V (£3). I bought this at a local shop because it was convenient. Would have preferred a lighter, smaller, thinner LiPo battery but the ones they had were too big. Features One of the consequences of using a LCD touch screen is that it gives you a lot more flexibility in terms of programming the behaviour of the machine. The minimum requirement would have been Feed Rate, Speed, Spin Control, Sweep, Elevation and Depth. Apart from these usual options found on most tennis ball machines, I wanted to add some extra options which I called Bias to try to simulate more realistic play. The Bias options are: *Left/Right Bias: This can be used to control where most of the balls are sent. For example, a left bias sends a larger proportion to the left side of the court. *Defense/Attack Bias: You can simulate various play styles from very defensive to very attacking. Very defensive play usually means slower, higher balls aimed at the center of the court. Very attacking play means fast, low balls aimed at the corners. *Near/Far Bias: Determines how much running you have to do. Near bias makes sure the next ball will bounce near (within 3 yards) of the previous ball. Far bias means the ball can be sent anywhere. Internals The remote control didn't need much soldering in the end. The main reason for this is that the LCD has 28 pins with a spacing of 0.05" making it way too small to solder onto a strip board. I had to use lots of interconnecting wires instead which made it untidy as you can see in the picture. Arduino Pro Mini 3.3V 328P Soldered R/Angle male headers onto it including the programming pins which I connect to another Arduino when I want to upload new code to it. The diagram on the right shows how I used the pins on the Arduino. Graphics LCD 128x64 I needed a thin LCD with either a 4 pin parallel input or a serial interface. I didn't have enough spare pins to use an 8 bit interface. This LCD uses a ST7565R controller and a fast SPI interface. It also needed 8 additional 1uF capacitors to control voltage levels. Connections on the LCD is via a Single-in-line 28 pin block which uses 0.05" spacing which makes soldering really difficult. To connect the LCD, I used thin 7/02 equipment wire, took out 4 of the 7 strands, used a small needle to enlarge the gap and then slid the wire over the pin. If the pin perforated the plastic side, I had to redo it. To connect the capacitors, I used the same 7/02 wire but took out all the strands and just used the sleeve. I did try using 0.6mm heat shrink but that was too thick. Using equipment wire worked quite well so I decided to use it to connect up most of the components. The SPI link on the LCD works well and I can refresh the screen in 5ms which is equivalent to 200fps. In SPI mode, you can't read the screen memory so I had to use 1k of memory on the Arduino to store the screen memory which is a lot considering the Arduino only had 2k of memory. DS Resistive Touchscreen The touchscreen connector contains 4 connections; Y1, X2, Y2, X1 and I used the Sparkfun tutorial to connect it up. I also added pull-down resistors to Y1 and X2 so that I would get a 0 value if the screen wasn't touched. Otherwise you would get a random floating value. RF AM 433 Transmitter Connected transmitter's Vcc to Arduino pin 3 rather than Arduino Vcc so that I could turn off the transmitter to save power as the quiescent current is too high. Right now I just send serial data at 600 baud but I will eventually use the Arduino VirtualWire library so that it can take care of the preamble and encoding. NiMH Battery 3.6V 210mAH Battery is connected to Aruino Vraw and GND. I also have a 100k/100k resistor divider across it which is connected to Arduino A3 pin so that I can measure the voltage of the battery. I use this to control recharging. The Arduino automatically goes into sleep mode when not in use. This cuts power consumption from 10mA to 0.33mA which means the remote lasts a month between recharge. Charging Connector A 3 pin header is used to connect the remote to the main machine so that the battery can be recharged and is configured so that it won't do any damage if it is connected the wrong way around. The main recharging circuit will be on the main machine but it will be controlled by the remote control. The 3 pin header config is : Pin 1 - Vpwm control pin (Output). Turns the recharge current on and off. This pin is either Input High which will turn on the charging or Output Low which will turn off the charging. This means if the connector is the wrong way round, it won't cause any damage. Connects to the base of the transistor used to control the LM317 chip. Pin 2 - Vbatt power pin (Input). Connects to battery + terminal on remote, and LM317 Vout on the main machine. Pin 3 - Vgnd ground pin (Input). Connects to battery - terminal on remote, and ground on the main machine. The recharging circuit in the main machine consists of a LM317 and a control transistor to turn the 317 on and off. A protection diode on pin 2 ensure that the current cannot flow back into the machine. Software The sofware modules are: *Low power mode. When idling, the cpu switches off the LCD and the RF Transmitter and goes into sleep mode. Touching the screen brings it back to life. This significantly reduces power consumption. When in use, the unit consumes 10mA and in sleep mode 0.33mA so it can last nearly a month without recharge. It wakes up every 2 seconds for a few milliseconds to see if the touchscreen is in use. *Battery recharger. The main tennis machine will have a docking station for the remote which will automatically recharge the remote battery from the main SLA battery. The software controlling the charger is on the remote control and uses fast charging. A 1 minute charge will allow the remote to last for 3 hours. *LCD driver. Driver is used to control a ST7565R LCD graphics controller in SPI mode. (LCD Driver Code) *LCD Graphics *